<template>
	<div>
		<!-- 面包屑导航区 -->
		<el-breadcrumb separator-class="el-icon-arrow-right">
			<el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
			<el-breadcrumb-item>咨询系统</el-breadcrumb-item>
			<el-breadcrumb-item>员工签到</el-breadcrumb-item>
		</el-breadcrumb>
		<el-card>
			<!-- 表单 -->
			<el-form :inline="true" v-bind:model="formInline" class="demo-form-inline">
				<el-form-item label="名称">
					<el-input v-model="formInline.UserName" placeholder="请输入名称"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="onSubmit" round>搜索</el-button>
				</el-form-item>
			</el-form>
			<!-- 表格 -->
			<el-table :data="tableData" border style="width: 100%">
				<el-table-column prop="Id" label="编号">
				</el-table-column>
				<el-table-column prop="UserName" label="名称">
				</el-table-column>
				<el-table-column prop="CheckinTime" label="签到时间">
				</el-table-column>
				<el-table-column prop="CheckState" label="签到状态">
				</el-table-column>
				<el-table-column prop="CheckOutTime" label="签退时间">
				</el-table-column>
				<el-table-column prop="IsCancel" label="签退状态">
				</el-table-column>
				<el-table-column prop="Weight" label="权重">
				</el-table-column>
			</el-table>
			<!-- 分页 -->
			<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"
			 :page-sizes="[10, 15, 20, 25]" :page-size="limit" layout="total, sizes, prev, pager, next, jumper " :total="count">
			
			</el-pagination>
		</el-card>
	</div>
</template>
<script>
	export default{
		data(){
			return{
				formInline: {
					UserName: ''
				},
				tableData: [],
				page: 1,
				limit: 10,
				count: 0,
			}
		},	
		created(){
			this.getTableList()
		},
		methods:{
			onSubmit(){
				this.getTableList()
			},
			handleSizeChange(val) {
				this.limit = val;
				this.getTableList()
			},
			handleCurrentChange(val) {
				this.page = val;
				this.getTableList()
			},
			async getTableList() {
				const {
					data: res
				} = await this.$http.get('api/ZiXun/GetList', {
					params: {
						page: this.page,
						limit: this.limit,
						UserName: this.formInline.UserName
					}
				})
				this.count = res.count;
				this.tableData = res.data;
			}
		}
	}
</script>

<style>·
	.el-tag{
		margin: 7px;
	}
	.bdtop{
		border-top: 1px solid #EEEEEE;
	}
	.bdbuttom{
		border-bottom: 1px solid #EEEEEE;
	}
	.vcenter{
		display: flex;
		align-items: center;
	}
</style>
